package HomeWork.salary;

/**
 * Enjoy programming!!!
 * Time: 2021/12/24 -  23:49
 */
import java.util.Scanner;
public class Salary {
    public static void main(String[] args){

        Scanner in = new Scanner(System.in);
        int year = in.nextInt();
        int hour = in.nextInt();
        double money;

        if (year < 5) {
            if (hour <= 40) {
                money = hour * 30;
            }else{
                money = (hour - 40) * 45 + 40 * 30;
            }
        } else{
            if (hour <= 40) {
                money = hour * 50;
            }else{
                money = (hour - 40) * 75 + 40 * 50;
            }
        }
        System.out.printf("%.2f",money);

    }
}
